package io.renren.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 功能描述：
 *
 * @Author: lyc
 * @Date: 2022/12/11 12:32
 */

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    /**
     * 资源映射到本地路径
     * @param registry
     */

    @Value("${file-save-path}")
    private String fileSavePath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/images/**")
                .addResourceLocations("file:" + fileSavePath);
        System.out.println("file:" + fileSavePath);
//                .addResourceLocations("file:" + "/Users/ycl/Desktop/img/");
    }


}
